package org.dengyiqian.notification;

import lombok.extern.slf4j.Slf4j;
import org.dengyiqian.client.NotificationRequest;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public record NotificationConsumer(
        NotificationService notificationService) {

    @RabbitListener(queues = "${rabbitmq.queues.notification}")
    public void consumer(NotificationRequest notificationRequest) {
        log.info("已经处理来自消息队列的消息: {} ", notificationRequest);
        notificationService.notifyCustomer(notificationRequest);
    }
}